﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt
{
	// Token: 0x02000094 RID: 148
	public class TCreateMaterializedSqlStatement : TCustomSqlStatement
	{
		// Token: 0x1700008D RID: 141
		// (get) Token: 0x0600042E RID: 1070 RVA: 0x002FAD58 File Offset: 0x002F8F58
		// (set) Token: 0x0600042F RID: 1071 RVA: 0x002FAD60 File Offset: 0x002F8F60
		public virtual TViewAliasClause ViewAliasClause
		{
			get
			{
				return this.viewAliasClause;
			}
			set
			{
				this.viewAliasClause = value;
			}
		}

		// Token: 0x1700008E RID: 142
		// (get) Token: 0x06000430 RID: 1072 RVA: 0x002FAD69 File Offset: 0x002F8F69
		// (set) Token: 0x06000431 RID: 1073 RVA: 0x002FAD71 File Offset: 0x002F8F71
		public virtual TSelectSqlStatement Subquery
		{
			get
			{
				return this.subquery;
			}
			set
			{
				this.subquery = value;
			}
		}

		// Token: 0x06000432 RID: 1074 RVA: 0x002FAD7A File Offset: 0x002F8F7A
		public TCreateMaterializedSqlStatement(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstcreatematerializedview;
		}

		// Token: 0x1700008F RID: 143
		// (get) Token: 0x06000433 RID: 1075 RVA: 0x002FAD8B File Offset: 0x002F8F8B
		// (set) Token: 0x06000434 RID: 1076 RVA: 0x002FAD93 File Offset: 0x002F8F93
		public virtual TObjectName ViewName
		{
			get
			{
				return this.viewName;
			}
			set
			{
				this.viewName = value;
			}
		}

		// Token: 0x06000435 RID: 1077 RVA: 0x002FAD9C File Offset: 0x002F8F9C
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TCreateMaterializedViewSqlNode tcreateMaterializedViewSqlNode = (TCreateMaterializedViewSqlNode)this.rootNode;
			base.doParseStatement(psql);
			this.viewName = tcreateMaterializedViewSqlNode.ViewName;
			this.subquery = new TSelectSqlStatement(this.dbvendor);
			this.subquery.rootNode = tcreateMaterializedViewSqlNode.SelectSqlNode;
			this.subquery.doParseStatement(this);
			if (tcreateMaterializedViewSqlNode.ViewAliasClause != null)
			{
				tcreateMaterializedViewSqlNode.ViewAliasClause.doParse(this, ESqlClause.viewAlias);
				this.viewAliasClause = tcreateMaterializedViewSqlNode.ViewAliasClause;
			}
			return 0;
		}

		// Token: 0x06000436 RID: 1078 RVA: 0x002FAE25 File Offset: 0x002F9025
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000437 RID: 1079 RVA: 0x002FAE35 File Offset: 0x002F9035
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			this.subquery.acceptChildren(v);
			if (this.viewAliasClause != null)
			{
				this.viewAliasClause.acceptChildren(v);
			}
			v.postVisit(this);
		}

		// Token: 0x040010E3 RID: 4323
		private TSelectSqlStatement subquery;

		// Token: 0x040010E4 RID: 4324
		private TViewAliasClause viewAliasClause;

		// Token: 0x040010E5 RID: 4325
		private TObjectName viewName;
	}
}
